# Contributor: Lauren N. Liberda <lauren@selfisekai.rocks>
# Maintainer: Lauren N. Liberda <lauren@selfisekai.rocks>
pkgname=oauth2-proxy
pkgver=7.5.1
pkgrel=1
pkgdesc="Reverse proxy that provides authentication with Google, Azure, OpenID Connect and many more identity providers"
url="https://oauth2-proxy.github.io/oauth2-proxy"
arch="all"
license="MIT"
install="$pkgname.pre-install"
makedepends="go"
subpackages="$pkgname-openrc"
source="
	https://github.com/oauth2-proxy/oauth2-proxy/archive/v$pkgver/oauth2-proxy-$pkgver.tar.gz

	oauth2-proxy.initd
	oauth2-proxy.confd
	"
options="net"

build() {
	VERSION="$pkgver" make oauth2-proxy
}

check() {
	go test ./...
}

package() {
	install -Dm755 oauth2-proxy "$pkgdir"/usr/bin/oauth2-proxy
	install -Dm755 "$srcdir"/oauth2-proxy.initd "$pkgdir"/etc/init.d/oauth2-proxy
	install -Dm755 "$srcdir"/oauth2-proxy.confd "$pkgdir"/etc/conf.d/oauth2-proxy
	install -Dm644 contrib/oauth2-proxy.cfg.example "$pkgdir"/etc/oauth2-proxy/oauth2-proxy.cfg
}

sha512sums="
8047fc8ca6f35955e024a7872365b753651d1a2cf29e45a7cdd840f2ef09cd3dbf650237176c78a932b5c0ac6c667f29db94a2a7c35469dd21a42871cdf6ace7  oauth2-proxy-7.5.1.tar.gz
4f91d8bff4ced7fca4d0795c2a0a89e0c8cb28f981db435f30b30f122757b8fe9d855a0d4d87497becedc543cdf48d20f3bc7813728bffaeac891d927157a237  oauth2-proxy.initd
56ec244414ecc96cad80b7c3f231c9e437350046ec80edc3661753bf24e194c51472acf2b097d893f3aed4200b0304e20e9c4d6edd05d698ff54524137c726e7  oauth2-proxy.confd
"
